/*
 * =====================================================================================
 *
 *       Filename:  socket.hpp
 *
 *    Description:  
 *
 *        Version:  0.1a
 *        Created:  17.05.2012 21:52:41
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Waldemar Gorbunov, 
 *   Organization:  
 *
 * =====================================================================================
 */

#ifndef SSLSOCKET_HPP_
#define SSLSOCKET_HPP_

#include "globals.hpp"
#include "config.hpp"
#include "socket.hpp"

#include <openssl/rand.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/bio.h>

namespace Drosera {

class SSLSocket : public Socket {

	public:
		SSLSocket ( SSL* );
		SSLSocket ( void );
		virtual ~SSLSocket ( void );

		int sslacceptSocket ( SOCKET, SSL* );
		bool sendSocket ( std::string& );
		int recvSocket ( std::string& );
		bool initSocket ( const char*, const char* );

	private:
		SSL *m_ssl;
		SSL_CTX *m_ctx;
		static bool m_status;
	protected:
		void setFileTransfer ( void );
		void setSSL ( SSL* );
		void clearUp ( void );
		SSL_CTX *getCTX ( void );
};
}
#endif

